package com.hippo.core.ui.compose.login

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.hippo.core.R
import com.hippo.core.ui.components.BottomSheetDialog
import com.hippo.core.ui.components.ThemeButton
import com.hippo.core.ui.theme.HippoTheme


@Composable
fun ProtocolDialog(onDismissRequest: ()->Unit,onAgree: ()->Unit,modifier: Modifier = Modifier) {

    BottomSheetDialog(
        modifier = modifier,
        title = stringResource(R.string.account_1),
        onDismissRequest = onDismissRequest
    ) {

        Column {

            Image(
                modifier = Modifier.size(75.dp),
                painter = painterResource(id = R.mipmap.protocol),
                contentDescription = null
            )
            Spacer(modifier = Modifier.height(30.dp))

            Text(
                modifier = Modifier.padding(top = 16.dp),
                text = stringResource(R.string.protocol_1),
                style = TextStyle(
                    color = Color.Black,
                    fontWeight = FontWeight.Bold,
                    fontSize = 25.sp,
                )
            )

            Text(
                text = "By selecting \"I Agree\" below, I confirm that I have reviewed an  and acknowledge the Terms of Use  and acknowledge the Privacy Notice. . I also confirm that I am at least 18 years of age.",
                modifier = Modifier.padding(top = 16.dp),
                style = TextStyle(
                    color = Color.Gray,
                    fontSize = 16.sp,
                )
            )

            Spacer(modifier = Modifier.height(50.dp))

            ThemeButton(
                text = stringResource(R.string.agree),
                onClick = onAgree
            )

        }

    }

}


@Preview
@Composable
private fun ProtocolDialogPreview() {

    HippoTheme {
        ProtocolDialog(
            onDismissRequest = {},
            onAgree = {}
        )
    }


}